import axios from "./axios";

const Cnode_URL = "https://cnodejs.org/api/v1";
const MY_URL = "http://localhost:8686";

export const CnodeRequset = (options) => {
  return new Promise((resolve, reject) => {
    axios({
      url: Cnode_URL + (options.url || ""),
      method: options.method || "GET",
      data: options.data || {},
    })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const myRequset = (options) => {
  return new Promise((resolve, reject) => {
    axios({
      url: MY_URL + options.url,
      method: options.method || "GET",
      data: options.data || {},
    })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
